/* eslint-disable react/prefer-stateless-function */
import { h, Component } from 'preact';
import classNames from 'classnames';


const config = {
	'B-3.0': {
		Icon: {
			tag: 'i',
			className: 'glyphicon'
		}
	},
	'B-4.0': {
		Icon: {
			tag: 'i',
			className: 'fa'
		}
	}
};

export function ComponentAdapt (Ele,displayName){
	const config = getConfig()[displayName];
	return class Adapt extends Component{
		static displayName = displayName;
		render({ className,tag,...other }){
			return <Ele className={classNames(config.className,className)} tag={tag||config.tag} {...other} />;
		}
	};
}

export default function getConfig(v){
	return config[v||'B-4.0'];
}